package 笔试真题;



public class Tengxun21 {
    public ListNode solve(ListNode[] a) {
        // write code here
        ListNode dummy = new ListNode(0);
        ListNode temp = dummy;
        while (true){
            boolean flag = false;
            for (int i = 0; i < a.length; i++) {
                ListNode listNode = a[i];
                if(listNode!=null){
                    temp.next = listNode;
                    temp = temp.next;
                    a[i] = listNode.next;
                    flag = true;
                }
            }
            if(!flag){
                break;
            }
        }
        return dummy.next;
    }
}
